Skip to content

Conversation

vbvictor
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2025

@llvm/pr-subscribers-github-workflow

Author: Baranov Victor (vbvictor)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/163873.diff

1 Files Affected:

  • (modified) .github/workflows/containers/github-action-ci-tooling/Dockerfile (+18-1)
diff --git a/.github/workflows/containers/github-action-ci-tooling/Dockerfile b/.github/workflows/containers/github-action-ci-tooling/Dockerfile
index 7d64562876628..5e13455d70123 100644
--- a/.github/workflows/containers/github-action-ci-tooling/Dockerfile
+++ b/.github/workflows/containers/github-action-ci-tooling/Dockerfile
@@ -9,6 +9,8 @@ RUN apt-get update && \
     mkdir -p /llvm-extract && \
     tar -xvJf llvm.tar.xz -C /llvm-extract \
         # Only unpack these tools to save space on Github runner.
+        LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION%%.*} \
+        LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION%%.*}/include \
         LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
         LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format \
         LLVM-${LLVM_VERSION}-Linux-X64/bin/git-clang-format && \
@@ -51,11 +53,26 @@ RUN pip install -r requirements_formatting.txt --break-system-packages && \
 FROM base AS ci-container-code-lint
 ARG LLVM_VERSION
 
-COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy ${LLVM_SYSROOT}/bin/
+COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
+                            /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION%%.*} \
+                            ${LLVM_SYSROOT}/bin/
+COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION%%.*}/include \
+                            ${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION%%.*}/include
 COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py
 
+# Make symlinks as in LLVM tar.xz package
+RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION%%.*} ${LLVM_SYSROOT}/bin/clang && \
+    ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
+
 ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
 
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -y \
+    cmake \
+    ninja-build && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
+
 # Install dependencies for 'pr-code-lint.yml' job
 COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
 RUN pip install -r requirements_linting.txt --break-system-packages && \

Comment on lines 12 to 13
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION%%.*} \
LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION%%.*}/include \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm installing clang "manually" together with built-in libs that are needed for clang-tidy invocation.

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested that you can run clang-tidy in the container with these changes?

@vbvictor
Copy link
Contributor Author

Have you tested that you can run clang-tidy in the container with these changes?

Yes, I've checked that I can configure,build,run clang-tidy-diff.py inside container

@vbvictor
Copy link
Contributor Author

I can't reproduce podman build error locally

Error: resolving step {Value:copy Next:0xc000266310 Children:[] Attributes:map[] Original:COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy                             /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION%%.*}                             ${LLVM_SYSROOT}/bin/ Flags:[--from=llvm-downloader] StartLine:56 EndLine:58}: Missing ':' in substitution: /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION%%.*}

So I use separate ARG variable for major LLVM version

@@ -1,14 +1,18 @@
ARG LLVM_VERSION=21.1.0
ARG LLVM_VERSION_MAJOR=21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if we put a little bit more effort into trying to consolidate these. There's almost certainly a way to get it working.

Is the local/Github difference maybe related to podman versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax is supported in docker/buildkit stack but I couldn't find that it is supported in podman/buildah stack. Locally I have Buildah 1.39 and in CI it's 1.33. I checked https://buildah.io/releases/ but nothing mentioned "variable expansions" in release notes from 1.33 to 1.39, so I have generally no idea how it works locally.

Copy link
Contributor Author

@vbvictor vbvictor Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I found openshift/imagebuilder@88c69f9 (available in v1.2.12 or more) which adds support for %% syntax.

Copy link
Contributor Author

@vbvictor vbvictor Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://buildah.io/releases/#changes-for-v1370 bumped imagebuilder version to v1.2.14 which supports %% and other shell syntax. So we essentially need to have Buildah 1.37 instead of 1.33 in CI (Ubuntu 24.04).

Copy link
Contributor Author

@vbvictor vbvictor Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think we can use LLVM_VERSION_MAJOR and leave a TODO for Ubuntu-26.04 runners, which should have higher version of Buildah (Ubuntu-25.04 has 1.39).

Another option is to move to docker buildx but I don't think we want it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. I'm fine leaving a TODO for ~6 months given we have an understanding of what the issue is, which we do now. Nice investigation.

@vbvictor vbvictor force-pushed the add-clang-tidy-native-runner branch from 9ba0e5d to 4dd94be Compare October 17, 2025 21:59
@vbvictor vbvictor force-pushed the add-clang-tidy-native-runner branch from 4dd94be to 27c773e Compare October 19, 2025 10:35
@vbvictor vbvictor merged commit e4c97f0 into llvm:main Oct 19, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants